<%@ page contentType="text/html;charset=UTF-8" language="java" %>


<jsp:useBean id="dbAgentStatusBean" scope="request" type="com.googlecode.monitoring.web.DbAgentStatusBean"/>
<h2>Web Monitoring</h2>

<h3>Summary</h3>

<div class="summary">
    <%
        if (dbAgentStatusBean.getMonitoringProcessUp() == null) {
    %>
    <div class="stateNeutral">
        Web monitoring agent state is unknown
    </div>
    <%
    } else if (dbAgentStatusBean.getMonitoringProcessUp() == Boolean.TRUE) {
    %>
    <div class="stateGood">
        Web monitoring agent is up
    </div>
    <%
    } else {
    %>
    <div class="stateBad">
        Web monitoring agent is down
    </div>
    <%
        }
    %>

    <%

        if (dbAgentStatusBean.isDataFound()) {

    %>

    <%
        if (dbAgentStatusBean.getOutdatedItemsCount() == 0) {
    %>
    <div class="stateGood">
        All pages are up to date
    </div>
    <%
    } else {
    %>
    <div class="stateBad">
        <%=dbAgentStatusBean.getOutdatedItemsCount()%> item(s) outdated
    </div>
    <%
        }
    %>

	<div >
		Web state last updated: <%=dbAgentStatusBean.getLastModified()%>
	</div>
    <%

    } else { // data file is not found

    %>

    <div class="stateBad">
        Monitoring state data file is not found<br/>
        (<%=dbAgentStatusBean.getStatusURI()%>)
    </div>

    <%

        }

    %>
</div>